Configure NIS Server
2013/07/04 |
Configure NIS Server in order to share users' accounts in your local networks. |
[root@dlp ~]#
[root@dlp ~]# yum -y install ypserv rpcbind ypdomainname srv.world # set NIS domain name
[root@dlp ~]#
vi /var/yp/Makefile
# MERGE_PASSWD=true|false
# line 50: change MERGE_PASSWD= false
# MERGE_GROUP=true|false
# line 54: change MERGE_GROUP= false
# line 125: add all: passwd shadow group hosts rpc services netid protocols
[root@dlp ~]#
vi /var/yp/securenets 255.255.255.0 10.0.0.0
[root@dlp ~]#
vi /etc/hosts # add own IP address 10.0.0.30 dlp.srv.world dlp systemctl start rpcbind.service [root@dlp ~]# systemctl start ypserv.service [root@dlp ~]# systemctl start yppasswdd.service [root@dlp ~]# systemctl enable rpcbind.service [root@dlp ~]# systemctl enable ypserv.service [root@dlp ~]# systemctl enable yppasswdd.service
[root@dlp ~]#
/usr/lib64/yp/ypinit -m # update NIS database
At this point, we have to construct a list of the hosts which will run NIS
servers. dlp is in the list of NIS server hosts. Please continue to add
the names for the other hosts, one per line. When you are done with the
list, type a <control D>. next host to add: dlp.srv.world next host to add: # Ctrl + D key The current list of NIS servers looks like this:
dlp
Is this correct? [y/n: y]
y # answer yes We need a few minutes to build the databases... Building /var/yp/srv.world/ypservers... Running /var/yp/Makefile... gmake[1]: Entering directory `/var/yp/srv.world' Updating passwd.byname... Updating passwd.byuid... Updating shadow.byname... Updating group.byname... Updating group.bygid... Updating hosts.byname... Updating hosts.byaddr... Updating rpc.byname... Updating rpc.bynumber... Updating services.byname... Updating services.byservicename... Updating netid.byname... Updating protocols.bynumber... Updating protocols.byname... Updating mail.aliases... gmake[1]: Leaving directory `/var/yp/srv.world'
dlp has been set up as a NIS master server.
Now you can run ypinit -s dlp on all slave server.
# It's neccessary to update NIS database with following way if new user is added again [root@dlp ~]# cd /var/yp [root@dlp yp]# |